<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 *公告管理
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';
if($_RQ['op']=='list'){
	$id=intval($_RQ['id']);
	if(!$id){
		exi('请选择客户！','error');
	}
	$user=pdo_get('jy_zhongyi_worker_user',array('uniacid'=>$_SESSION['uniacid'],'id'=>$id));
	$params=array('uniacid'=>$_SESSION['uniacid'],'worker_id'=>$user['workerid'],'mid'=>$user['mid'],'bodyid'=>$user['bodyid']);
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$total='';
	$list=pdo_getslice('jy_zhongyi_lesson_log',$params,array($pindex,$psize),$total,$fields,'','id desc');
	if($list){
		foreach($list as &$item){
			$item['member']=cfc('core')->member_show($item['mid']);
			$item['username']=pdo_getcolumn('jy_zhongyi_user',array('mid'=>$item['mid']),'name');
			$item['name']=pdo_getcolumn('jy_zhongyi_body',array('id'=>$item['bodyid']),'name');
			$item['name']=$item['name']?:'无';
			$item['sex']=pdo_getcolumn('jy_zhongyi_body',array('id'=>$item['bodyid']),'sex');
			$item['sex']=$item['sex']==0?'女':'男';
			if($item['storeid']){
				$item['storetitle']=pdo_getcolumn('jy_zhongyi_store',array('id'=>$item['storeid']),'title');
			}
		}
	}
	$return['list']=$list;
	$totalpage=ceil($total/$psize);
	$totalpage=intval($totalpage);
	$return['totalpage'] =$totalpage;
	$return['params']['page'] =$pindex;
	$htmls=array(
		'type'=>'list',
		'list'=>array('data'=>'list','edit'=>false,'del_one'=>false,'delall'=>false,'list'=>array(
			array('title'=>'患者','type'=>'img_string','img'=>'avatar',
			'data'=>array(
				array('title'=>'家长：','name'=>'username'),
				array('title'=>'家人：','name'=>'name','unit'=>'sex')
				)
			),
			array('name'=>'remark','title'=>'病历内容','type'=>'string'),
		)),
	);
	$return['htmls']=$htmls;
	exi($return);
}